package com.dragonfly.shutter.controllers;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.dragonfly.shutter.beans.Message;

/**
 * 注销控制器
 * @author 黄挺
 *
 */
@Controller
@RequestMapping("/logout.html")
public class LogOutController {
	@RequestMapping(method = RequestMethod.GET)
	public ModelAndView onLoad(HttpSession session){
		Integer userID = (Integer) session.getAttribute("userID");
		Message message = null;
		
		if(userID != null ){
			session.removeAttribute("userID");
		}
		
		message = new Message("注销成功","注销成功，即将跳转到主页","index.html");
		return new ModelAndView("message", "message", message);
	}
}
